package com.c5p1ng.route.config;

import com.c5p1ng.route.filter.HeaderContentFilter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@ConditionalOnWebApplication
public class FilterAutoConfiguration {

    @Bean(name = "headerContentFilterBean")
    public FilterRegistrationBean flowDyeFilter() {
        FilterRegistrationBean registrationBean = new FilterRegistrationBean(new HeaderContentFilter());
        registrationBean.addUrlPatterns("/*");
        registrationBean.setName("HeaderContentFilter");
        registrationBean.setOrder(1);
        return registrationBean;
    }

}